﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace MyVideoPlayer.Converters
{
    class DicValueConverter : MultiConverterBase
    {
        public override object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value[0] is IDictionary dic && value[1] is string key && dic.Contains(key))
                return dic[key] ?? Binding.DoNothing;
            return Binding.DoNothing;
        }

        public override object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            return [Binding.DoNothing, Binding.DoNothing];
        }
    }
}
